//
//  ViewController.swift
//  testSwift
//
//  Created by zhou Can on 15/7/8.
//  Copyright (c) 2015年 zhou Can. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    var c:String?
    weak var d:ViewController?
    @IBAction func push(sender: AnyObject) {
        self.navigationController?.pushViewController(ViewController(), animated: true)
    }
    var a:A?
    var b:B?
    override func viewDidLoad() {
        super.viewDidLoad()
        c = "test"
        d = self
        // Do any additional setup after loading the view, typically from a nib.
        a = A(str: "i'am A")
        a?.block = {
            [unowned self] str in
            println("\(str) ---- \(self.d)----")
        }
        b = B(str: "i'am B")
        a?.b = b
        a?.demo = b?.name
        b?.demo = a?.name
        b?.a = a
        a?.testBlock({[unowned self]  (progress) -> Void in
            println("\(progress) ---- \(self.d)----\(self.a?.name)")
        })

    }
    
    deinit
    {
        println("ViewController Deinit")
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

